package com.qdxwx.web.controller.ajax;

import com.qdxwx.common.json.AjaxResult;
import com.qdxwx.common.utils.TKConvert;
import com.qdxwx.data.service.course.CourseFileService;
import com.qdxwx.models.course.CourseFile;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import jakarta.servlet.http.HttpServletRequest;
import java.util.List;

/*
 * node章节api
 * */
@Controller
@RequestMapping("/ajax/course/file")
public class AjaxCourseFileController {

    @Autowired
    private CourseFileService courseFileService;

    @RequestMapping("/list.json")
    @ResponseBody
    public AjaxResult List(HttpServletRequest request){
        int courseId = TKConvert.toInteger(request.getParameter("courseId"));
        List<CourseFile> courseFileList = courseFileService.getList(courseId);
        return AjaxResult.success(courseFileList);
    }

}
